#ifndef CONSUMER_H
#define CONSUMER_H
#include "../common/message.pb.h"
#include "../common/Log.hpp"
#include <memory>
#include <functional>
using namespace std;

using ConsumerCallback = function<void(const string, const MessageQueue::BasicProperties *bp, const string)>;

struct Consumer
{
    using ptr = shared_ptr<Consumer>;
    string tag;    //消费者标识
    string qname;  //消费者订阅的队列名称
    bool auto_ack;      //自动确认标志
    ConsumerCallback callback;

    Consumer()
    {
        lg(Debug, "new Consumer: %p", this);
    }

    Consumer(const string &ctag, const string &queue_name,  bool ack_flag, const ConsumerCallback &cb)
        : tag(ctag), qname(queue_name), auto_ack(ack_flag), callback(std::move(cb))
    {
        lg(Debug, "new Consumer: %p", this);
    }

    ~Consumer() 
    {
        lg(Debug, "del Consumer: %p", this);
    }
};

#endif